home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / DELPHI / LEDIT108.ZIP / LEMFC / LEMFC_1V.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-26  |  2.5 KB  |  102 lines

  1. #include "stdafx.h"
  2. #include "lemfc.h"
  3. #include "lemfc_1.h"
  4. #include "lemfc_1d.h"
  5. #include "lemfc_1v.h"
  6.  
  7. #ifdef _DEBUG
  8. #undef THIS_FILE
  9. static char BASED_CODE THIS_FILE[] = __FILE__;
  10. #endif
  11.  
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CLemfc_1View
  14.  
  15. IMPLEMENT_DYNCREATE(CLemfc_1View, CLEditView)
  16.  
  17. BEGIN_MESSAGE_MAP(CLemfc_1View, CLEditView)
  18.     //{{AFX_MSG_MAP(CLemfc_1View)
  19.     ON_WM_CREATE()
  20.     //}}AFX_MSG_MAP
  21.     // Standard printing commands
  22. END_MESSAGE_MAP()
  23.  
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CLemfc_1View construction/destruction
  26.  
  27. CLemfc_1View::CLemfc_1View()
  28. {
  29.     // TODO: add construction code here
  30.     m_clrBackColor = RGB(192,192,192);
  31.     m_clrForeColor = RGB(0,0,0);
  32.     m_clrBackColorSelected = RGB(255,0,0);
  33.     m_clrForeColorSelected = RGB(255,255,255);
  34. }
  35.  
  36. CLemfc_1View::~CLemfc_1View()
  37. {
  38. }                              
  39.  
  40. // Handles highlight of every single word. Neesa ES_HIGHLIGHT
  41. void 
  42. CLemfc_1View::OnControlHighlight(WORDDESC& WD, CDC* pDC)
  43. {
  44.    switch (WD.wCode)
  45.    {
  46.      
  47.      case WD_QUOTEDTEXT:
  48.      case WD_BADLYQUOTEDTEXT:
  49.        pDC->SetTextColor(RGB(0,128,0));
  50.        break;
  51.      case WD_SIMPLEWORD:            
  52.        if (lstrcmpi(WD.caWord,"HREF") == 0)
  53.          {
  54.            pDC->SetTextColor(RGB(255,0,0));
  55.            break; 
  56.          }
  57.      default:
  58.        pDC->SetTextColor(RGB(0,0,255));
  59.        break; 
  60.      case WD_SYNTAXITEM:
  61.        pDC->SetTextColor(RGB(255,255,255));
  62.    }
  63. }
  64.    
  65.  
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CLemfc_1View diagnostics
  68.  
  69. #ifdef _DEBUG
  70. void CLemfc_1View::AssertValid() const
  71. {
  72.     CView::AssertValid();
  73. }
  74.  
  75. void CLemfc_1View::Dump(CDumpContext& dc) const
  76. {
  77.     CView::Dump(dc);
  78. }
  79.  
  80. CLemfc_1Doc* CLemfc_1View::GetDocument() // non-debug version is inline
  81. {
  82.     ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CLemfc_1Doc)));
  83.     return (CLemfc_1Doc*)m_pDocument;
  84. }
  85. #endif //_DEBUG
  86.  
  87. /////////////////////////////////////////////////////////////////////////////
  88. // CLemfc_1View message handlers
  89.  
  90. int CLemfc_1View::OnCreate(LPCREATESTRUCT lpCreateStruct) 
  91. {
  92.     if (CLEditView::OnCreate(lpCreateStruct) == -1)
  93.         return -1;     
  94.         
  95.     GetLEditCtrl().SetHighlight(TRUE); // Highlighting == YES!!!
  96.     GetLEditCtrl().SetMultilineItems(TRUE); // Must be before SetStartInComments
  97.     GetLEditCtrl().SetStartInComments(TRUE);
  98.     GetLEditCtrl().SetSyntax("2\"\\001>1<1=");
  99.     
  100.     return 0;
  101. }
  102.